-- critical_magic
-- created by zhuangsl
-- 伤害类魔法造成暴击

return {
    apply = function(prop, baseValue)
        return math.modf(baseValue * prop[3] / 1000);
    end,

    -- 对敌伤害触发
    trigger = function(who, prop, arg)
        if type(arg) ~= "number" then
            return 0;
        end

        local damage = math.modf(arg * prop[3] / 1000);

        if prop[2] == "ear" then
            -- 萨满之耳，干掉状态
            if CombatStatusM.checkStatus(who, "shaman_ear") then
                -- 设置为当前回合结束
                local condition = CombatStatusM.queryCondition(who, "shaman_ear");
                condition["end_round"] = CombatM.getRound();
            end
        end

        return math.max(1, damage);
    end,

    record = function(target, prop, path)
        return false;
    end
};
